/**
 * 功能描述
 */
define(function (require, exports, module) {
    //引入视图基类
    var ELView = require("elview");

    //assets
    var template = require("./assets/tpl/contractStat_main.tpl");
    require("./assets/css/contractStat_main.css");

    //business

    //component

    //constant
    var contracStatSubnavComp = require("./component/contractStatSubnav");
    var contracStatGridComp = require("./component/contractStatGrid");
    var contracStatCountGridComp = require("./component/contractStatCountGrid");
    //handler

    //store

    var App = ELView.extend({
        attrs: {
            template: template
        },
        initComponent: function (params, widget) {
        	contracStatSubnavComp.initComponent(params,widget);
        	contracStatGridComp.initComponent(params,widget);
        	contracStatCountGridComp.initComponent(params,widget);

        },
        afterInitComponent: function (params, widget) {
        	widget.get("grid").refresh(null,function(datas){
        		var k = 0;
        		for(var i in datas){
        			k+=(datas[i].allMoney == null ? 0 : datas[i].allMoney);
        		}
        		widget.get("grid").setTitle("收入合计:"  + k +".00元")
        		
        	});
            
        }
    });

    module.exports = App;
});
